/**
 * 练习题
 */
interface IUser {
    id: number;
    name: string;
    phone: string;
}
function findObjById<T extends IUser>(obj: T[], id: number) {
    const temp = obj.find(item=>item.id == id)
    //返回的对象，电话号码需要处理
    const regexp = /(\d{3})\d{4}(\d{4})/
    temp?.phone.replace(regexp,"$1****$2")
    return temp
}
let array:IUser[] = [
    { id: 1, name: "xiaowang", phone: "13790089763" },
    { id: 2, name: "xiaofei", phone: "13567890872" }
]
findObjById(array, 1)
